<%-- any content can be specified here e.g.: --%>
<%@page import="dao.ManagerDAO"%>
<%@ page pageEncoding="UTF-8" %>
<%!    
    String username;
    String logoutBtn;
    String msg;
%>
<%
    username = (String) request.getSession().getAttribute("Username");
    if (username == null || username.trim().length() == 0) {
        username = "";
    }
    logoutBtn = request.getParameter("logoutBtn");
    if (logoutBtn != null) {
        request.getSession().removeAttribute("Username");
        response.sendRedirect(request.getContextPath() + "/public/login.jsp");
    }
%>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

        <title>Student Management System</title>

        <!-- Bootstrap core CSS -->
        <link href="<%=request.getContextPath()%>/css/bootstrap.css" rel="stylesheet">
        <link href="<%=request.getContextPath()%>/css/footer.css" rel="stylesheet">
        <link href="<%=request.getContextPath()%>/css/index.css" rel="stylesheet">
        <script src="<%=request.getContextPath()%>/js/jquery.js"></script>
        <script src="<%=request.getContextPath()%>/js/jquery.dataTables.min.js"></script>
        <script src="<%=request.getContextPath()%>/js/dataTables.bootstrap.js"></script>
        <script src="<%=request.getContextPath()%>/js/bootstrap.min.js"></script>
    </head>

    <body>

        <div id="header" class="navbar navbar-inverse navbar-fixed-top" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="#">SMS</a>
                </div>
                <div class="collapse navbar-collapse">
                    <ul class="nav navbar-nav">
                        <li id="homeLi"><a href="<%=request.getContextPath()%>/public/index.jsp">Home</a></li>
                        <li id="contractLi"><a href="<%=request.getContextPath()%>/restricted/listStudent.jsp">Student</a></li>
                        <li id="staffLi"><a href="<%=request.getContextPath()%>/restricted/listManager.jsp">Manager</a></li>
                        <li id="accountLi"><a href="<%=request.getContextPath()%>/restricted/account.jsp">Account</a></li>
                    </ul>
                    <ul class="nav navbar-nav navbar-right">
                        <%if (!username.equals("")) {%>
                        <li><p class="navbar-text navbar-right">Logged in as <font color="#f3f3f3"><%=username%></font></p></li>
                        <%}%>
                        <li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <form class="navbar-right" action="<%=request.getContextPath()%>/public/login.jsp" method="POST">
                                <%if (!username.equals("")) {%>
                                <input name="logoutBtn" type="submit" class="btn btn-danger navbar-btn" value="Logout" />
                                <%} else {%>
                                <input name="logoutBtn" type="submit" class="btn btn-success navbar-btn" value="Login" />
                                <%}%>
                            </form>
                        </li>
                    </ul>
                </div><!--/.nav-collapse -->
            </div>
        </div>
    </body>
</html>